//
//  ChooseIMGCollectionCell.m
//  HCFrame
//
//  Created by huachun on 2018/6/26.
//  Copyright © 2018年 丁 一. All rights reserved.
//

#import "ChooseIMGCollectionCell.h"

@implementation ChooseIMGCollectionCell

-(instancetype)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
        
        if (!_Img_view) {
            _Img_view       = [[UIImageView alloc] init];
            _Img_view.layer.masksToBounds=YES;
            _Img_view.layer.cornerRadius=5.0;
            _Img_view.contentMode = UIViewContentModeScaleAspectFill;
            [self.contentView addSubview:_Img_view];
        }
        
        if (!_Img_button) {
            _Img_button = [UIButton buttonWithType:UIButtonTypeCustom];
            [_Img_button addTarget:self action:@selector(delete_img)  forControlEvents:UIControlEventTouchUpInside];
            [self.contentView addSubview:_Img_button];
        }
    }
    return self;
}

-(void)delete_img{
    
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"确定要删除吗" message:nil preferredStyle:UIAlertControllerStyleAlert];
    [alertController addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
    }]];
    [alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
        self->_selectBlock(YES);
    }]];
    [_SuperVC presentViewController:alertController animated:YES completion:nil];
}


@end
